package com.xxxxx.Servlet;

import java.io.IOException;


import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

@WebServlet("/s2")
public class TestServlet02 extends HttpServlet {
	
	//重写doGet方法
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		System.out.println("Get请求.....");
		resp.getWriter().write("Get");
		//在doGet方法里面调用doPost方法
		this.doPost(req, resp);
	}
	
	//重写doPost方法
	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		System.out.println("Post请求.....");
		resp.getWriter().write("Post");
	}
	/*
	@Override
	protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
			//在servers里面打印Hello Servlet!
			System.out.println("Hello Servlet! ");
			//在浏览器里面打印Hello Servlet!
			response.getWriter().write("Hello Servlet! ");
	}
	*/
	
	
	
		
}
